#! /bin/sh

. /lib/lsb/init-functions

do_start()
{
	[ -f /etc/hostname ] && hn=$(cat /etc/hostname)
	[ -z "$hn" ] && hn=$(hostname)
	[ -z "$hn" ] && hn=yclinux

	log_info_msg "Setting hostname to '$hn'"
	hostname "$hn" && log_success_msg || log_failure_msg
}

case "$1" in
	start|restart|reload|"") do_start ;;
	stop) ;;
	*) echo "Usage: $0 {start|stop}" >&2 ; exit 1;;
esac

exit 0
